<?php
namespace Aiweline\Core\Model;

use Aiweline\Core\Api\HelloInterface;
use Aiweline\Core\Helper\Mdb;

class Hello implements HelloInterface
{
    protected $db = null;

    function __construct(Mdb $db)
    {
        $this->db = $db;
    }

    /**
     * Returns greeting message to user
     *
     * @api
     * @param string $name Users name.
     * @return string Greeting message with users name.
     */


    public function name($name)
    {
//        return "Aiweline(麦进斗) Aiweline_Core：Hello, " . $name;
        $table = \Aiweline\Core\Setup\InstallSchema::table_MJD_EMAIL_WAIT_SEND_ENTITY;
        $db = $this->db;
        $where = [
            'status' => ['0', 'OR', 2]
        ];
        $data = $db->table($table)
            ->where(['entity_id' => 3])
            ->update(['send_time' => time(), 'status' => 1])
            ->fetch();
        return $data;
    }
}